package com.douqu.game.core.config;

import com.douqu.game.core.config.common.GoodsData;
import com.douqu.game.core.entity.GameObject;

/**
 * @author: miracle.
 * Description: boss掉落配置
 * Date: 2018/3/21 0021 上午 11:51
 * Huan Yu Copyright (c) 2017 All Rights Reserved.
 */
public class AuctionConfig extends GameObject{
    /**
     * 物品类型id数量
     */
    public GoodsData good;
    /**
     * 资源类型id价格
     */
    public GoodsData price;
    /**
     * 一口价
     */
    public int highestPrice;
    /**
     * 每次加价
     */
    public int addPrice;
    /**
     * 拍卖持续时间
     */
    public int keepTime;

    @Override
    public boolean check() {
        return super.check();
    }

    @Override
    public String toString() {
        return "BossDropConfig{" +
                "id=" + id +
                ", good=" + good +
                ", price=" + price +
                ", highestPrice=" + highestPrice +
                ", addPrice=" + addPrice +
                ", keepTime=" + keepTime +
                '}';
    }

    @Override
    public boolean setVariable(String key, String value) {
        if("good".equals(key))
        {
            good = new GoodsData(value);
            return good.check(this.getClass(), key, id);
        }
        else if("price".equals(key))
        {
            price = new GoodsData(value);
            return price.check(getClass(), key, id);
        }
        else
            return super.setVariable(key, value);
    }

}
